/*
 * thread.h - defines a portable thread class
 *
 * Copyright(c) Bert van der Weerd <bsod@well.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This file is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING. If not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA.
 *
 */

class thread_base {};

class thread_imp_base
{
public:
  virtual void set_client(thread_base* client_){};
  virtual bool start(void* data_) = 0;
};
class mutex_imp_base
{
public:
  virtual void unlock() = 0;
  virtual void lock() = 0;
};


	class thread : public thread_base
	{
		public:
			thread();
			virtual ~thread();

			// call this to start the thread, returns false if it can't
			// be created.
			bool run(void* data);

		protected:
			// override this to provide the thread implementation
			virtual void execute(void* data) = 0;

		private:
			friend class thread_imp;
			thread_imp_base* imp;
	};

	class mutex
	{
	public:
		mutex();
		virtual ~mutex();

		void lock();
		void unlock();
	private:
		friend class mutex_imp;
		mutex_imp_base* imp;
	};
